import { createStore } from 'vuex'
import type from './mutation-types'

export default createStore({
  state: {
    userToken: localStorage.getItem('userToken') ? localStorage.getItem('userToken') : '',
    userType: localStorage.getItem('userType') ? localStorage.getItem('userType') : '',
  },
  getters: {
  },
  mutations: {
    /*设置用户token*/
    [type.SET_USER_TOKEN] (state, token) {
      // mutate state
      state.userToken = token;
    },
    [type.SET_USER_TYPE] (state, type) {
      // mutate state
      state.userType = type;
    },
  },
  actions: {
  },
  modules: {
  }
})
